package com.slz3.business.module.orderManagement.ordOrder.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.orderManagement.ordOrder.domain.OrdOrder;
import com.slz3.business.module.orderManagement.ordOrder.domain.OrdOrderFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class OrdOrderTransactionalServiceImpl implements OrdOrderTransactionalService {

    @Override
    public OrdOrder modify(OrdOrder ordOrderNew) {
        Repositorys.ordOrder.test();
        Repositorys.ordOrder.save(OrdOrderFactory.initBaseFields());
        System.err.println(1/0);
        ordOrderNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.ordOrder.saveAndFlush(ordOrderNew);
    }

    @Override
    public List<OrdOrder> batchModify(List<OrdOrder> ordOrderList) {
        return Repositorys.ordOrder.saveAll(ordOrderList);
    }
}
